<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>渠道推广管理 列表</title>
<jsp:include page="../../import.jsp" flush="true"/>
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">

			<div class="FXBR">
				<div class="fieldBox">
					<div class="label">渠道号</div>
					<div class="field">
						<input name="sourceNm" id="sourceNm" type="text" class="ui-textbox" value="" ligerui="width: 160">
					</div>
				</div>
			</div>

            <div class="clearFix"></div>
	            <div class="btnsBox formBtns notRight">
					<span id="clearBtn" onclick="clearBtn();" class="sq-button-round">清空</span>
					<span id="searchBtn" onclick="searchBtn();" class="sq-button-round">查询</span>
				</div>
        	</div>
        </form>
    </div>
</div>
<div id="mcrSourcePopGrid" class="sq-grid"></div>
</div>

<script type="text/javascript">
	var grid = null;
	$(function () {
	    initForm();
		initGrid();
	});

	//初始化表单
	function initForm(){
		$("#searchBar").ligerForm();
	}
	
	//查询按钮事件
	function searchBtn(){
		 var form = new liger.get("searchBar");
		 var data = form.getData();
		 for (name in data){
			grid.setParm(name,data[name]);
		 };
		grid.reload();
	}
	
	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
        var data = form.getData();
        return data;
	}
	
	//初始化列表
	function initGrid(){
		$("#mcrSourcePopGrid").ligerGrid({
	    	url: '<%=path%>/mcr/mcrSourcePop/initList.do',
	    	method : 'post',
	    	isSingleCheck: false,
	    	parms:getSearchParams(),
	        columns: [
				{ display: '编号', name: 'id', width: 150, enabledSort:true},
				// { display: '渠道ID', name: 'sourceId', width: 150, enabledSort:true },
	            { display: '渠道号', name: 'sourceNm', width: 150, enabledSort:true },
	            { display: '借款笔数', name: 'loanCount', width: 150, enabledSort:true},
				{ display: '借款金额', name: 'loanAmt', width: 150, enabledSort:true,
					render:function(rowData,index,value){
						if(rowData.loanAmt){
							return '&yen;'+rowData.loanAmt;
						}
					}
				},
				{ display: '佣金计算', name: 'brokerage', width: 150, enabledSort:true,
					render:function(rowData,index,value){
						if(rowData.brokerage){
							return '&yen;'+rowData.brokerage;
						}
					}
				}
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:true,
	        rownumbers:true
	    });
	    grid = liger.get("mcrSourcePopGrid");
	    grid.setHeight(100);
	}

	//清空按钮事件
	function clearBtn(){
		$("#resetBtn").click();  //重置 input-text
		var form = new liger.get("searchBar");
		form.setData({  //重置select等特殊表单
			"sourceNm":""
		});
	}

</script>

</body>
</html>